Skip to content

Add documentation about OpenXR spatial entities #11015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BastiaanOlij
Copy link
Contributor

This PR adds documentation for the spatial entities implementation being added here: godotengine/godot#107391

@BastiaanOlij BastiaanOlij added this to the 4.x milestone Jun 11, 2025
@BastiaanOlij BastiaanOlij self-assigned this Jun 11, 2025
@BastiaanOlij BastiaanOlij added enhancement topic:xr Related to XR documentation labels Jun 11, 2025
@AThousandShips AThousandShips added the waiting on PR merge PR's that can't be merged until an engine PR is merged first label Jun 11, 2025
Copy link

@JD-The-65th JD-The-65th left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a few grammatical issues and typos so I wanted to make a review addressing some of them. I saw that it was also a commonality in this PR to omit commas after dependent clauses, so I left in 2 cases where I noticed it occurred, but I can go back and mark more where I noticed them.

@AThousandShips AThousandShips removed this from the 4.x milestone Jun 12, 2025
Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do a pass to improve sentence structure as well later

@BastiaanOlij
Copy link
Contributor Author

Thanks for the feedback everyone, just to let you all know, I'm planning on updating this PR after we're certain about the API on the implementation PR just to minimize having to go back and forth on those changes. Will be updating this PR soonish

@BastiaanOlij BastiaanOlij force-pushed the openxr_spatial_entities_docs branch 6 times, most recently from 27ac884 to a5b0b4a Compare August 6, 2025 05:54
@BastiaanOlij BastiaanOlij force-pushed the openxr_spatial_entities_docs branch from a5b0b4a to 4edb00e Compare August 6, 2025 05:56


**
Q : Should we be doing update queries here to get position changes for markers??
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly a reminder to myself, I need to add this in. We now do this in the built-in logic as well.

@BastiaanOlij
Copy link
Contributor Author

I think I covered all the comments, only some outstanding stuff around parameter naming which remains a problem.

Also need to find some time to add update queries to the marker example.

Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions for breaking up the sentences, can look at more cases later

how they are found, and how information about them is stored and accessed.

Various extensions are added on top that implement specific systems such as marker tracking,
plane tracking and anchors. These are referred to as spatial capabilities.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
plane tracking and anchors. These are referred to as spatial capabilities.
plane tracking, and anchors. These are referred to as spatial capabilities.

Various extensions are added on top that implement specific systems such as marker tracking,
plane tracking and anchors. These are referred to as spatial capabilities.

Each entity that can be handled by the system is broken up into smaller components which makes it easy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Each entity that can be handled by the system is broken up into smaller components which makes it easy
Each entity that can be handled by the system is broken up into smaller components, which makes it easy

All entity trackers will expose their location through the ``default`` pose.

We can automate creating these subscenes and adding them to our scene tree by creating a manager
object. As all locations are local to the :ref:`XROrigin3D<class_XROrigin3D>` node we should create
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
object. As all locations are local to the :ref:`XROrigin3D<class_XROrigin3D>` node we should create
object. As all locations are local to the :ref:`XROrigin3D<class_XROrigin3D>` node, we should create

each type of entity.

Generally speaking we will instance different subscenes for each type of entity.
As the tracker objects can be used with :ref:`XRAnchor3D<class_XRAnchor3D>` nodes these subscenes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
As the tracker objects can be used with :ref:`XRAnchor3D<class_XRAnchor3D>` nodes these subscenes
As the tracker objects can be used with :ref:`XRAnchor3D<class_XRAnchor3D>` nodes, these subscenes

Alternatively we can assign a material that will visualize the plane for debugging.

We configure this material as the ``material_override`` material on our MeshInstance3D.
For our "hole punch" material create a :ref:`ShaderMaterial<class_ShaderMaterial>`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For our "hole punch" material create a :ref:`ShaderMaterial<class_ShaderMaterial>`
For our "hole punch" material, create a :ref:`ShaderMaterial<class_ShaderMaterial>`

OpenXR spatial entities
=======================

For any sort of augmented reality application you need to access real world information and be able to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For any sort of augmented reality application you need to access real world information and be able to
For any sort of augmented reality application you need to access real world information, and be able to

Note that various XR devices also require permission flags to be set. These will need to be
enabled in the export preset settings.

Enabling the different capabilities activates the related OpenXR APIs but additional logic is needed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Enabling the different capabilities activates the related OpenXR APIs but additional logic is needed
Enabling the different capabilities activates the related OpenXR APIs, but additional logic is needed

For each core system we have built-in logic that can be enabled that will do this for you.

We'll discuss the spatial entities system under the assumption the built-in logic is enabled first.
We will then take a look at the underlying APIs and how you can implement this yourself however it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We will then take a look at the underlying APIs and how you can implement this yourself however it
We will then take a look at the underlying APIs and how you can implement this yourself, however it

When a spatial anchor has been made persistent, a Universally Unique Identifier (or UUID) is
assigned to the anchor. You will need to store this with whatever information you need to
reconstruct the scene.
In our example code below we'll simply call ``set_scene_path`` and ``get_scene_path`` but you
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In our example code below we'll simply call ``set_scene_path`` and ``get_scene_path`` but you
In our example code below we'll simply call ``set_scene_path`` and ``get_scene_path``, but you

"unpersistent" and then clean up the anchor.
Also you will get an error if you try to destroy an anchor that is still persistent.

To complete our anchor system we start with creating a scene that we'll set as the scene
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To complete our anchor system we start with creating a scene that we'll set as the scene
To complete our anchor system we start by creating a scene that we'll set as the scene

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement topic:xr Related to XR documentation waiting on PR merge PR's that can't be merged until an engine PR is merged first
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants